package com.shengzai.rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Demo3Map {
  def main(args: Array[String]): Unit = {

    val conf = new SparkConf()
    conf.setMaster("local")
    conf.setAppName("CountStudent")
    val sc = new SparkContext(conf)

    val worldRDD: RDD[String] = sc.textFile("hadoop_code/src/data/students.txt")
    worldRDD.map(
      line=>{
        val name: String = line.split(",")(1)
        val clazz: String = line.split(",").last
        (name,clazz)
      }
    ).foreach(println)

    /**
     * map算子：数据量不变，原RDD的行数和结果RDD的行数不变
     */



  }
}
